﻿using UnityEditor;
using UnityEngine;
using TowerDefence_Zombie;

namespace GameHelper.Config//命名空间根据所在项目需要更改，默认为 ConfigCreator
{
    /// <summary>
    /// Config创建器，代码为自动生成不允许手动修改
    /// </summary>
    public static class GameConfigCreator
    {
        private static void CreateConfigInstance<T>() where T : ConfigBase
        {
            T config = ScriptableObject.CreateInstance<T>();
            string path = @"Assets/ConfigCreator/Resources/Configs/" + config.GetType().Name + ".asset";
            AssetDatabase.CreateAsset(config, path);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            Selection.activeObject = AssetDatabase.LoadAssetAtPath<ScriptableObject>(path);
        }

/*
        [MenuItem(ConfigCreatorConst.CONFIG_CREATE_PATH + nameof(#配置类名#))]
        private static void Create#配置类名#()
        {
            CreateConfigInstance<#配置类名#>();
        }
*/
    }
}